<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="lijun; 67086071; zwlijun@qq.com" />
<title>RIA Client API - BY 小网</title>
<link href="css/api.css" type="text/css" rel="stylesheet" />
</head>

<body>
  <ins>此文档描述Sort对象</ins>
  <div class="nav">
    <a href="#sort">sort()</a>
  </div>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">sort方法<a name="sort"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>对数组集合进行排序</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>var items = Sort.HeapSort.sort(items, key);</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>对数组集合进行排序，参数key为可选参数，在对象引用时的排序键</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
var arr = [1,32,2,3,3,2,65,86,34,5654,445,33,89];
RIAClient.$E("s1").innerHTML = "排序前：" + arr;
RIAClient.$E("v1").innerHTML = "排序后：" 
    + Sort.HeapSort.sort(arr);
var obj = [
  {index:23, code:"A00123"},
  {index:1, code:"A001232"},
  {index:54, code:"AB0233"},
  {index:33, code:"C00133"},
  {index:4, code:"EF0123"},
  {index:87, code:"GE0133"},
  {index:24, code:"WW0153"},
  {index:7, code:"QDS883"},
  {index:90, code:"SDF143"},
  {index:400, code:"OPU623"},
  {index:323, code:"HG0663"},
  {index:266, code:"GWQD23"}
];
RIAClient.$E("s2").innerHTML = "排序前：" 
    + JSON.json2string(obj);
RIAClient.$E("v2").innerHTML = "排序后：" 
    + JSON.json2string(Sort.HeapSort.sort(obj, "index"));
</pre>
        </td>
      </tr>
    </tbody>
  </table>
</body>
</html>